package cn.schoolwow.quickdao.module.operation.kit;

import cn.schoolwow.quickdao.domain.DAO;
import cn.schoolwow.quickdao.domain.database.dml.TransactionConsumer;
import cn.schoolwow.quickdao.domain.database.parent.UpgradeRequest;
import cn.schoolwow.quickdao.domain.operation.GenerateJavaSourceFileRequest;
import cn.schoolwow.quickdao.domain.transaction.Transaction;

import java.util.function.Consumer;

public interface DAOOperation {
    /**
     * 开启事务
     */
    Transaction startTransaction();

    /**
     * 开启事务
     */
    void startTransaction(TransactionConsumer transactionConsumer);

    /**
     * 数据库升级语句
     * */
    void upgrade(String comment, Consumer<DAO> upgradeConsumer);

    /**
     * 数据库升级语句
     * */
    void upgrade(UpgradeRequest upgradeRequest);

    /**
     * 根据数据库表生成实体类java文件
     * */
    void generateJavaSourceFile(GenerateJavaSourceFileRequest generateEntityFileRequest);

    /**
     * 重新初始化数据库
     * */
    void initialDatabase();

    /**
     * 清空实体类表
     * */
    void clearEntityTable();
}
